#import <Cocoa/Cocoa.h>

#import "BWBorkStitchDocument.h"
#import "BWStitch.h"

@interface BWBorkStitchDocument (StitchUndoMethods)

- (void) setupStitchUndo;

- (void) removeStitchesAtIndexes: (NSIndexSet *) stitchIndexes;
- (void) removeStitch: (BWStitch *) stitch;

- (void) addStitch: (BWStitch *) stitch
        atPosition: (int) position;

- (void) flipStitchIndexes: (NSIndexSet *) indexes;

- (void) orderStitch: (BWStitch *) stitch
          toPosition: (int) position
          actionName: (NSString *) actionName;

- (void) bringIndexesForward: (NSIndexSet *) indexes;
- (void) sendIndexesBack: (NSIndexSet *) indexes;

- (void) shiftStitchesHorizontal: (int) hDirection
                        vertical: (int) vDirection
                         indexes: (NSIndexSet *) indexes; // nil for all

- (void) setStartLabelVisibility: (BOOL) startOnOff
              endLabelVisibility: (BOOL) endOnOff
                       forStitch: (BWStitch *) stitch;

- (void) setStartLabelVisibility: (BOOL) startOnOff
              endLabelVisibility: (BOOL) endOnOff
                      forIndexes: (NSIndexSet *) indexes;

- (void) setCustomStartLabel: (NSString *) label
                   forStitch: (BWStitch *) stitch;
- (void) setCustomStartLabel: (NSString *) label
                  forIndexes: (NSIndexSet *) indexes;
- (void) setCustomEndLabel: (NSString *) label
                 forStitch: (BWStitch *) stitch;
- (void) setCustomEndLabel: (NSString *) label
                forIndexes: (NSIndexSet *) indexes;
- (void) removeCustomLabelsForStitch: (BWStitch *) stitch;
- (void) removeCustomLabelsForIndexes: (NSIndexSet *) indexes; 


- (void) setStartLabelInside: (BOOL) inside
                   forStitch: (BWStitch *) stitch;
- (void) setStartLabelInside: (BOOL) inside
                  forIndexes: (NSIndexSet *) indexes; // iterates, calling the above
- (void) setEndLabelInside: (BOOL) inside
                   forStitch: (BWStitch *) stitch;
- (void) setEndLabelInside: (BOOL) inside
                forIndexes: (NSIndexSet *) indexes; // iterates, calling the above

- (void) setLabelFont: (NSFont *) font;

- (void) changeStartLabelDisplacement: (float) displacement
                           forIndexes: (NSIndexSet *) indexSet;
- (void) changeEndLabelDisplacement: (float) displacement
                         forIndexes: (NSIndexSet *) indexSet;

- (void) changeStartLabelDisplacementAngle: (float) degrees
                                forIndexes: (NSIndexSet *) indexSet;
- (void) changeEndLabelDisplacementAngle: (float) degrees
                              forIndexes: (NSIndexSet *) indexSet;

- (void) setStartLabelVisibility: (BOOL) startVisible
              endLabelVisibility: (BOOL) endVisible
                customStartLabel: (NSString *) startLabel
                  customEndLabel: (NSString *) endLabel
                startLabelInside: (BOOL) startInside
                  endLabelInside: (BOOL) endInside
          startLabelDisplacement: (float) startDisplacement
            endLabelDisplacement: (float) endDisplacement
     startLabelDisplacementAngle: (float) startAngle
       endLabelDisplacementAngle: (float) endAngle
    // font
                      forIndexes: (NSIndexSet *) indexSet; // nil for all
    

// does the undo coalesce thing

- (void) changeWidth: (float) width
          forIndexes: (NSIndexSet *) indexes;

- (void) changeFillColor: (NSColor *) color
              forIndexes: (NSIndexSet *) indexes;

- (void) changeBendFactor: (float) bendFactor
               forIndexes: (NSIndexSet *) indexes;

- (void) changeBendDisplacement: (float) bendDisplacement
                     forIndexes: (NSIndexSet *) indexes;

- (void) changeBendFlatness: (float) bendFlatness
                     forIndexes: (NSIndexSet *) indexes;

- (void) setArrow: (BWStitch_ArrowKind) arrow
       forIndexes: (NSIndexSet *) indexes;

- (void) changeArrowLength: (float) arrowLength
                forIndexes: (NSIndexSet *) indexes;

- (void) changeArrowWeight: (float) arrowWeight
                forIndexes: (NSIndexSet *) indexes;

- (void) changeArrowColor: (NSColor *) color
               forIndexes: (NSIndexSet *) indexes;


- (void) changeStartSquare: (BWGrid_Square) startSquare
                squarePart: (BWGrid_SquarePart) startPart
                 endSquare: (BWGrid_Square) endSquare
                squarePart: (BWGrid_SquarePart) endPart
                 forStitch: (BWStitch *) stitch;

- (void) changeBendFactor: (float) bendFactor
             displacement: (float) displacement
                forStitch: (BWStitch *) stitch;


@end // StitchUndoMethods



@interface BWBorkStitchDocument (FabricUndoMethods)

- (void) setupFabricUndo;

- (void) changeFabricFlatGrid: (BOOL) onOff;

// does the undo coalescing thing
- (void) changeFabricWidth: (float) newWidth;
- (void) changeFabricSpacing: (float) newSpacing;
- (void) changeFabricBackgroundColor: (NSColor *) newColor;
- (void) changeFabricThreadColor: (NSColor *) newColor;
- (void) changeFabricEdgeColor: (NSColor *) newColor;

// set all at once
- (void) setFabricWidth: (float) newWidth
                spacing: (float) spacing
                   flat: (BOOL) flat
             background: (NSColor *) backgroundColor
                 thread: (NSColor *) threadColor
                   edge: (NSColor *) edgeColor;

@end // FabricUndoMethods
